package com.fatsatsuma.spreadsheets;

import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.beanutils.BeanUtils;

import junit.framework.TestCase;

/**
 * 
 * @author gareth
 * 
 */
public class RowListenerTestCase extends TestCase implements RowListener {

	private String column1;

	private String column2;

	private Integer column3;

	public void execute() {
		assertEquals("value1", getColumn1());
		assertEquals("value2", getColumn2());
		assertEquals(3, (int) getColumn3());
	}

	public void testRowListener() throws IllegalAccessException, InvocationTargetException {
		Map<String, Object> row = new HashMap<String, Object>();
		row.put("column1", "value1");
		row.put("column2", "value2");
		row.put("column3", new Integer(3));
		BeanUtils.copyProperties(this, row);
		execute();
	}

	public String getColumn1() {
		return column1;
	}

	public void setColumn1(String column1) {
		this.column1 = column1;
	}

	public String getColumn2() {
		return column2;
	}

	public void setColumn2(String column2) {
		this.column2 = column2;
	}

	public Integer getColumn3() {
		return column3;
	}

	public void setColumn3(Integer column3) {
		this.column3 = column3;
	}

}
